#include "stdafx.h"

#include <gtest/gtest.h>
#include "../../../XProcess/JmpHooker.h"
#include "../../../XProcess/Module.h"

using namespace XProcess;

static int __stdcall sum1(int a)
{
    return a;
}

int __stdcall zero1(int(__stdcall *)(int), int a)
{
    return 0;
}

TEST(Hook, BasicHook)
{
    EXPECT_EQ(6, sum1(6));

    //JmpHooker<1, decltype(&sum1)>::hook(&sum1, &zero1);
    auto hooker = JmpHooker<1, int(int)>::hook(&sum1, &zero1);

    EXPECT_EQ(0, sum1(2));
    hooker.unHook();
}
